/*
 *  Copyright 2012 Dirk Vranckaert
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package eu.vranckaert.vvl.service;

import android.graphics.Bitmap;
import eu.vranckaert.vvl.exception.webservice.WebServiceException;
import eu.vranckaert.vvl.exception.webservice.WebServiceRequestFailureException;

/**
 * User: DIRK VRANCKAERT
 * Date: 17/02/12
 * Time: 18:22
 */
public interface WebService {
    /**
     * Executes an HTML GET for a certain url and returns the HTML-body.
     * @param url The web url of the HTML-page.
     * @return The HTML-body for the requested url.
     * @throws WebServiceException An exception when connecting to a service on the web and a connection failure (or
     * general IO Exception) occurred.
     * @throws WebServiceRequestFailureException A web request has been executed but failed based on the status code.
     * This exception contains the status code for further exception handling and to show create a well-explaining
     * error dialog.
     */
    String doHtmlGet(String url) throws WebServiceException, WebServiceRequestFailureException;

    /**
     * Executes an HTML GET for a certain url and returns an image.
     * @param url The web url image.
     * @return The image for the requested url.
     * @throws WebServiceException An exception when connecting to a service on the web and a connection failure (or
     * general IO Exception) occurred.
     */
    Bitmap doImageGet(String url) throws WebServiceException;
}
